<template>
  <view class="agreement" :style="[{paddingTop:statusBar+ 'px'}]">
		<view class="status" :style="[{height:statusBar+ 'px'}]" ></view>
		<view class="navigation" :style="[{top:(statusBar-2)+ 'px'}]">
			<image src="/static/images/back.png" class="back" @click="back()" mode=""></image>
			<view class="navigation-title">寄售协议</view>
		</view>
		<view class="navigation-position"></view>
    <web-view :src="host + 'wap/configs/user/service'" :style="[{paddingTop:statusBar+ 'px'}]" class="agreement-webview"></web-view>
  </view>
</template>

<script>
	/* function getRequestParams() {
			let url = location.href;
			let requestParams = {};
			if (url.indexOf('?') !== -1) {
				let str = url.substr(url.indexOf('?') + 1);
				let strs = str.split('&');
				for (let i = 0; i < strs.length; i++) {
					requestParams[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1]);
				}
			}
			return requestParams;
	}
	let params = getRequestParams();
	let token = params['token'];
	let status_bar =  params['status_bar'];
	let source = 'wap'
	if(token!=undefined){
		uni.setStorage({
		    key: 'token',
		    data: token
		})
		source = 'app'
	}
	if(status_bar!=undefined){
		uni.setStorage({
		    key: 'status_bar',
		    data: status_bar
		})
	} */
	import store from "store"
	import {mapGetters} from 'vuex'
import HostEnv from "mixins/HostEnv"
export default {
  name: "agreement",
	store,
	computed:{
		...mapGetters([
			'statusBar'
		])
	},
	data:()=>({
		source:source
	}),
  mixins: [HostEnv],
	methods:{
		back(){
			if(this.source == 'wap'){
				uni.navigateBack()
			}else{
				// window.flutter_inappwebview.callHandler('back_to_app', '')
				backToApp.postMessage('back');
			}
		}
	}
}
</script>

<style lang="scss" scoped>
	page{
		background: #FFFFFF;
	}
	.status {
		width: 100%;
		position: fixed;
		top: 0;
		z-index: 99;
		background: #F6F6F6;
	}
	.navigation{
		width: 100%;
		height: 100rpx;
		background: #F6F6F6;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		left:0;
		top:0;
		z-index:999;
	}
	.navigation-position{
		width: 100%;
		height: 100rpx;
		background: rgba(0,0,0,0);
	}
	.back{
		display: block;
		width: 48rpx;
		height: 48rpx;
		position: absolute;
		top: 26rpx;
		left:32rpx;
	}
	.navigation-title{
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
	}
	.agreement-webview{
		margin-top: 140rpx;
	}
</style>
